package com.czy.owner.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.czy.owner.R;
import com.czy.owner.entity.HomeServiceModel;
import com.czy.owner.entity.ShoppingModel;
import com.czy.owner.utils.glide.GlideUtils;
import com.easyrecycleview.adapter.BaseViewHolder;
import com.easyrecycleview.adapter.RecyclerArrayAdapter;

import org.xutils.image.ImageOptions;
import org.xutils.x;


/**
 * Created by asus on 2017/5/10.
 */
public class HomeHotShopBottomAdapter extends RecyclerArrayAdapter<ShoppingModel.HotMallListBean> {
    private Context context;
    public HomeHotShopBottomAdapter(Context context) {
        super(context);
        this.context=context;
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new HomeHotShopBottomHolder(parent);
    }

    class HomeHotShopBottomHolder extends BaseViewHolder<ShoppingModel.HotMallListBean> {
        private ImageView ivCategoryImg;
        private TextView tvCategoryName;
        private TextView tvCategoryMemo;

        public HomeHotShopBottomHolder(ViewGroup parent) {
            super(parent, R.layout.item_home_hotshop_bottom);
            ivCategoryImg = $(R.id.iv_category_img);
            tvCategoryName = $(R.id.tv_category_name);
            tvCategoryMemo = $(R.id.tv_category_memo);

        }

        @Override
        public void setData(ShoppingModel.HotMallListBean model) {
            super.setData(model);
            x.image().bind(ivCategoryImg,model.getLogo(), new ImageOptions.Builder()
                    .setFailureDrawableId(R.mipmap.icon_goods_list_default)
                    .setLoadingDrawableId(R.mipmap.icon_goods_list_default)
                    .build());


            tvCategoryName.setText(model.getTitle());
            tvCategoryMemo.setText(model.getDescription1());
        }
    }
}
